-- 创建生成加载数据脚本到gdb

local file = io.open(arg[1],"w+");
local no_pll = true;
assert(file,"create file f\n");

if(no_pll)then
   s = [[
target remote :3333
restore #BIN# binary 0x20000000
set $pc=0x20000000
# c
# disconnect
# quit
]]

else
    s = [[
    target remote :3333
    hb *0x80000000
    c
    restore #BIN# binary 0x20000000
    set $pc=0x20000000
    # c
    # disconnect
    # quit
    ]]
end

s = s:gsub('#BIN#',arg[2]);
file:write(s);
file:close();